<template>
  <section>
    <el-row>
      <el-card>
        <el-col :span="24">
          <div style="padding:20px 120px">
            <el-row style="margin:40px 0">
              <el-col>
                <span
                  style="display: flex;justify-content: left;margin-right: 50px"
                >
                  <el-button @click="saveSystem" type="primary">确定</el-button>
                  <el-button
                    :loading="loading3"
                    @click="RefRedis"
                    type="primary"
                    >刷新Redis数据</el-button
                  >
                  <el-dropdown
                    v-loading="loading1"
                    @command="handleCommand1"
                    style="margin-left:10px"
                  >
                    <el-button type="primary">
                      同步钉钉信息
                      <i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item command="syncDeptAndUser"
                        >全部</el-dropdown-item
                      >
                      <el-dropdown-item command="syncDept"
                        >部门信息</el-dropdown-item
                      >
                      <el-dropdown-item command="syncUser"
                        >用户信息</el-dropdown-item
                      >
                    </el-dropdown-menu>
                  </el-dropdown>
                </span>
              </el-col>
            </el-row>
            <el-form :inline="true" label-width="auto" label-position="center">
              <!-- 分类 -->
              <template>
                <el-tabs v-model="activeName">
                  <el-tab-pane label="系统设置" name="system">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="workflowWindowClose"
                          label="流程审批后关闭窗口:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.workflowWindowClose"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            :active-value="true"
                            :inactive-value="false"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="smsRetrySpan"
                          label="短信提醒间隔(天):"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入短信间隔时间"
                            v-model="SystemSettingPageList.smsRetrySpan"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col></el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item prop="serverId" label="服务ID:">
                          <el-input
                            class="input_content"
                            placeholder="请输入服务ID"
                            v-model="SystemSettingPageList.serverId"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item porp="systemName" label="系统名称:">
                          <el-input
                            class="input_content"
                            placeholder="请输入系统名称"
                            v-model="SystemSettingPageList.systemName"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="workflowRemindMessage"
                          label="催办提醒内容:"
                        >
                          <el-input
                            class="input_content"
                            type="textarea"
                            :rows="3"
                            placeholder="请输入催办提醒内容"
                            v-model="
                              SystemSettingPageList.workflowRemindMessage
                            "
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-tab-pane>
                  <el-tab-pane label="登录设置" name="login">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="loginCode"
                          label="登录验证码验证:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.loginCode"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            active-value="YES"
                            inactive-value="NO"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="isAssemblyRemind"
                          label="是否展示技术人员信息:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="
                              SystemSettingPageList.technicalServicePersonnelInfoRetry
                            "
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            :active-value="true"
                            :inactive-value="false"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="workflowRemindMessage"
                          label="技术服务人员信息:"
                        >
                          <el-input
                            class="input_content"
                            type="textarea"
                            :rows="2"
                            placeholder="请输入技术服务人员信息"
                            v-model="
                              SystemSettingPageList.technicalServicePersonnelInfo
                            "
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="internetContentProvider"
                          label="备案号:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入备案号"
                            v-model="
                              SystemSettingPageList.internetContentProvider
                            "
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="登录页窗口色值:">
                          <el-color-picker
                            style="margin: 0 50px;"
                            v-model="SystemSettingPageList.loginColor"
                            show-alpha
                            :predefine="predefineColors"
                          >
                          </el-color-picker>
                        </el-form-item>
                      </el-col>

                    </el-row>
                    <el-row>
                      <el-col :span="8">
                        <el-form-item
                          prop="loginBackground"
                          label="登陆页大背景图:"
                        >
                          <picture-upload
                            style="margin-left:10px"
                            v-model="SystemSettingPageList.loginBackground"
                            type="loginBackground"
                            @del-picture="delPicture"
                            @add-picture="addPicture"
                          ></picture-upload>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item
                          prop="loginSmallBackground"
                          label="登陆页小背景图:"
                        >
                          <picture-upload
                            style="margin-left:10px"
                            v-model="SystemSettingPageList.loginSmallBackground"
                            type="loginSmallBackground"
                            @del-picture="delPicture"
                            @add-picture="addPicture"
                          ></picture-upload>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item prop="loginLogo" label="登陆页logo:">
                          <picture-upload
                            style="margin-left:10px"
                            v-model="SystemSettingPageList.loginLogo"
                            type="loginLogo"
                            @del-picture="delPicture"
                            @add-picture="addPicture"
                          ></picture-upload>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-tab-pane>
                  <el-tab-pane label="首页设置" name="index">
                    <!-- <el-row>
                      <el-col :span="12">
                        <el-form-item prop="homeItemId" label="首页展示栏目:">
                          <span
                            id="column"
                            style="display:flex;margin-left: 10px;"
                          >
                            <el-input
                              style="width: 330px;float: left;box-sizing: border-box;font-size: 14px;text-align: left;"
                              placeholder="请选择栏目"
                              v-model="echoName"
                              disabled
                            >
                            </el-input>
                            <el-button type="primary" @click="showUserDialog"
                              >选择
                            </el-button>
                          </span>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="homeWorkflowJump"
                          label="首页流程更多跳转:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入首页流程更多跳转"
                            v-model="SystemSettingPageList.homeWorkflowJump"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="homeAnnouncementJump"
                          label="首页公文更多跳转:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入首页公文更多跳转"
                            v-model="SystemSettingPageList.homeAnnouncementJump"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="homeDocumentJump"
                          label="首页共享文档更多跳转:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入首页共享文档更多跳转"
                            v-model="SystemSettingPageList.homeDocumentJump"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row> -->
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="indexSystemName"
                          label="主页项目名称(图片):"
                        >
                          <picture-upload
                            style="margin-left:10px"
                            v-model="SystemSettingPageList.indexSystemName"
                            type="indexSystemName"
                            @del-picture="delPicture"
                            @add-picture="addPicture"
                          ></picture-upload>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item prop="indexLogo" label="主页logo:">
                          <picture-upload
                            style="margin-left:10px"
                            v-model="SystemSettingPageList.indexLogo"
                            type="indexLogo"
                            @del-picture="delPicture"
                            @add-picture="addPicture"
                          ></picture-upload>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-tab-pane>
                  <el-tab-pane label="账号设置" name="count">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="defaultUpdatePassword"
                          label="是否修改初始密码:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="
                              SystemSettingPageList.defaultUpdatePassword
                            "
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            :active-value="true"
                            :inactive-value="false"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="defaultPassword"
                          label="默认初始密码:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入初始默认密码"
                            v-model="SystemSettingPageList.defaultPassword"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          porp="passwordRetryCount"
                          label="密码重试次数:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入密码允许重试次数"
                            v-model="SystemSettingPageList.passwordRetryCount"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="loginLockedDate"
                          label="账号锁定时间(分钟):"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入账号锁定时间"
                            v-model="SystemSettingPageList.loginLockedDate"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="passwordRegular"
                          label="密码正则验证:"
                        >
                          <el-input
                            class="input_content"
                            type="textarea"
                            placeholder="请输入密码正则验证"
                            v-model="SystemSettingPageList.passwordRegular"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="passwordRegularMessage"
                          label="密码正则验证提示语:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入密码正则验证提示语"
                            type="textarea"
                            v-model="
                              SystemSettingPageList.passwordRegularMessage
                            "
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="tokenExpiredTime"
                          label="Token过期时间(小时):"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入Token过期时间"
                            v-model="SystemSettingPageList.tokenExpiredTime"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item prop="ipRetryCount" label="IP重试次数:">
                          <el-input
                            class="input_content"
                            placeholder="请输入ip重试次数"
                            v-model="SystemSettingPageList.ipRetryCount"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-tab-pane>
                  <!-- <el-tab-pane label="模板设置" name="template">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="来文登记导出模板:">
                          <el-upload
                            class="upload-demo"
                            :action="imgHead"
                            :headers="head"
                            :on-success="handleSuccess"
                            :on-error="handleError"
                            :on-preview="handlePreview"
                            :on-remove="handleRemove"
                            :limit="1"
                            :on-exceed="handleExceed"
                            :file-list="fileList"
                          >
                            <el-button size="small" type="primary"
                              >点击上传</el-button
                            >
                          </el-upload>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="信函登记导出模板:">
                          <el-upload
                            class="upload-demo"
                            :action="imgHead"
                            :headers="head"
                            :on-success="handleSuccess2"
                            :on-error="handleError2"
                            :on-preview="handlePreview2"
                            :on-remove="handleRemove2"
                            :limit="1"
                            :on-exceed="handleExceed2"
                            :file-list="fileList2"
                          >
                            <el-button size="small" type="primary"
                              >点击上传</el-button
                            >
                          </el-upload>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-tab-pane> -->
                  <!-- <el-tab-pane label="督办设置" name="duban">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="supervisionLeaderOpinionUqId"
                          label="点评意见督办领导:"
                        >
                          <user-select
                            :isMulSelect="true"
                            :class="'input_content'"
                            @getUser="getUserOpinion"
                            v-model="
                              SystemSettingPageList.supervisionLeaderOpinionUqId
                            "
                          ></user-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item prop="superviseTable" label="督办数据表:">
                          <el-input
                            class="input_content"
                            v-model="SystemSettingPageList.superviseTable"
                            placeholder="请输入督办数据表"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="supervisionMobileAllDataUqId"
                          label="移动端查看督办权限:"
                        >
                          <user-select
                            @getUser="getUserMobile"
                            :isMulSelect="true"
                            :class="'input_content'"
                            v-model="
                              SystemSettingPageList.supervisionMobileAllDataUqId
                            "
                          ></user-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="supervisionDefaultLeaderUqId"
                          label="督办默认抄送领导:"
                        >
                          <user-select
                            @getUser="getUserLeader"
                            :isMulSelect="true"
                            :class="'input_content'"
                            v-model="
                              SystemSettingPageList.supervisionDefaultLeaderUqId
                            "
                          ></user-select>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-tab-pane> -->
                  <!-- <el-tab-pane label="第三方设置" name="three">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="isTaskRemind"
                          label="是否发送第三方流程催办:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.isTaskRemind"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            :active-value="true"
                            :inactive-value="false"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="isAssemblyRemind"
                          label="是否发送第三方汇总汇编催办:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.isAssemblyRemind"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            :active-value="true"
                            :inactive-value="false"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="isAssemblyRemind"
                          label="是否发送第三方流程推送:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.isTaskPush"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            :active-value="true"
                            :inactive-value="false"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="isAssemblyRemind"
                          label="是否发送第三方汇总汇编推送:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.isAssemblyPush"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            :active-value="true"
                            :inactive-value="false"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="documentFlowId"
                          label="第三方获取TokenUrl:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入第三方获取Token的Url"
                            v-model="SystemSettingPageList.remindTokenUrl"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="documentFlowId"
                          label="第三方流程推送flowIds:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入第三方流程推送的flowIds"
                            v-model="SystemSettingPageList.pushTaskFlowIds"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          prop="documentFlowId"
                          label="第三方推送Url:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入第三方推送的Url"
                            v-model="SystemSettingPageList.pushSendUrl"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="documentFlowId"
                          label="第三方催办Url:"
                        >
                          <el-input
                            class="input_content"
                            placeholder="请输入第三方催办的Url"
                            v-model="SystemSettingPageList.remindSendUrl"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-tab-pane> -->
                  <el-tab-pane label="钉钉设置" name="ding">
                    <el-row>
                      <!-- <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="isAssemblyRemind"
                          label="是否开启钉钉扫码登录:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.dingLoginRetry"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            :active-value="true"
                            :inactive-value="false"
                          ></el-switch>
                        </el-form-item>
                      </el-col> -->
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="dingSync"
                          label="定时同步部门用户信息:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.dingSync"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            active-value="YES"
                            inactive-value="NO"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                      <!-- <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="dingMesDebug"
                          label="消息通知debug模式:"
                        >
                          <el-switch
                            style="margin-left: 10px"
                            v-model="SystemSettingPageList.dingMesDebug"
                            active-color="#13ce66"
                            active-text="开启"
                            inactive-text="关闭"
                            active-value="YES"
                            inactive-value="NO"
                          ></el-switch>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item
                          prop="dingMesUserId"
                          label="钉钉通知dingUserIds:"
                        >
                          <el-input
                            class="input_content"
                            type="textarea"
                            :rows="3"
                            placeholder="请输入钉钉消息通知的dingUserIds,用,隔开"
                            v-model="SystemSettingPageList.dingMesUserId"
                          ></el-input>
                        </el-form-item>
                      </el-col> -->
                    </el-row>
                  </el-tab-pane>
                  <el-tab-pane label="流程设置" name="flower">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          class="input_content1"
                          prop="flowSelectType"
                          label="流程步骤选择方式:"
                        >
                          <el-select
                            v-model="SystemSettingPageList.flowSelectType"
                            clearable
                            placeholder="请选择"
                          >
                            <el-option label="先步骤后用户" value="STEP_FIRST"></el-option>
                            <el-option label="步骤用户同时" value="STEP_USER"></el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-tab-pane>
                </el-tabs>
              </template>
            </el-form>
          </div>
        </el-col>
      </el-card>
    </el-row>
    <el-dialog title="请选择栏目" width="30%" :visible.sync="sortDialogVisible">
      <el-row style="text-align: center">
        <el-col :span="24" class="mt20">
          <el-tree
            class="filter-tree"
            :data="myColumnList"
            node-key="id"
            :props="defaultProps"
            show-checkbox
            check-strictly
            default-expand-all
            ref="columnTreeRef"
            highlight-current
            @node-click="handleClick"
            :default-checked-keys="columnCheckList"
          ></el-tree>
        </el-col>
      </el-row>
      <div slot="footer">
        <el-button type="primary" @click="saveColumn()">保存</el-button>
        <el-button @click="sortDialogVisible = false">返回</el-button>
      </div>
    </el-dialog>
  </section>
</template>
<script>
import { mapGetters } from "vuex";

export default {
  name: "systemConfig",
  created() {
    this.getSystemConfig();
    this.getColumnTree();
  },
  mounted() {
    this.appKey.unshift({ label: "全部", keyword: "all" });
  },
  computed: {
    ...mapGetters({
      myColumnList: "myColumnList"
    })
  },
  data() {
    return {
      activeName: "system",
      imgHead: window.api.sysUploadUrl + "?path=official/form/template",
      head: {
        userRole: "ADMIN",
        token: window.sessionStorage.getItem("token")
      },
      loading1: false,
      loading2: false,
      loading3: false,
      predefineColors: ["rgba(102,158,50,0.7)", "rgba(187,76,76,0.9)"],
      fileList: [],
      fileList2: [],
      appKey: this.getDictionary("SEARCH_APPKEY"),
      defaultProps: {
        children: "children",
        label: "name"
      },
      echoName: "",
      columnCheckList: [], // 栏目选择集合
      sortDialogVisible: false,
      loading: false,
      SystemSettingPageList: {},
      searchDto: {
        pageIndex: 1,
        pageSize: 10,
        keyword: ""
      }
    };
  },
  methods: {
    delPicture(type) {
      this.SystemSettingPageList[type] = "";
    },
    addPicture(val, type) {
      this.SystemSettingPageList[type] = val;
    },
    //上传成功
    handleSuccess(res, file, fileList) {
      this.SystemSettingPageList.officialRegisterExportFile = res.fileName;
      this.SystemSettingPageList.officialRegisterExportFileId = res.id;
    },
    handlePreview(file) {
      this.openTabPage(
        window.api.preFile +
          "?url=" +
          window.api.secretFilePreview +
          file.url +
          "?token=" +
          window.sessionStorage.getItem("token")
      );
    },
    handleRemove(file, fileList) {
      this.SystemSettingPageList.officialRegisterExportFile = "";
    },
    handleError(err, file, fileList) {
      this.$notify.error({
        title: "错误",
        dangerouslyUseHTMLString: true,
        duration: 2000,
        message: `<p style="display: block;width: 260px; word-wrap: break-word">${
          JSON.parse(err.message).message
        }</p>`
      });
    },
    handleExceed(files, fileList) {
      this.$message.warning(
        `当前限制选择 1 个文件，本次选择了 ${
          files.length
        } 个文件，共选择了 ${files.length + fileList.length} 个文件`
      );
    },
    // 上传成功
    handleSuccess2(res, file, fileList) {
      console.log(res);
      this.SystemSettingPageList.letterRegisterExportFile = res.fileName;
      this.SystemSettingPageList.letterRegisterExportFileId = res.id;
    },
    handlePreview2(file) {
      console.log(file);
      this.openTabPage(
        window.api.preFile +
          "?url=" +
          window.api.secretFilePreview +
          file.url +
          "?token=" +
          window.sessionStorage.getItem("token")
      );
    },
    handleRemove2(file, fileList) {
      this.SystemSettingPageList.letterRegisterExportFile = "";
    },
    handleError2(err, file, fileList) {
      this.$notify.error({
        title: "错误",
        dangerouslyUseHTMLString: true,
        duration: 2000,
        message: `<p style="display: block;width: 260px; word-wrap: break-word">${
          JSON.parse(err.message).message
        }</p>`
      });
    },
    handleExceed2(files, fileList) {
      this.$message.warning(
        `当前限制选择 1 个文件，本次选择了 ${
          files.length
        } 个文件，共选择了 ${files.length + fileList.length} 个文件`
      );
    },
    handleClick(data, node, self) {
      node.checked = !node.checked;
    },

    //下拉选择
    handleCommand(command) {
      let tem = { appKey: command };
      this.loading2 = true;
      this.API.initialElasticSearch(tem).then(() => {
        this.success("初始化成功");
        this.loading2 = false;
      });
    },
    handleCommand1(val) {
      let appAlias = "db";
      this.loading1 = true;
      this.API[val]({ appAlias: appAlias }).then(ret => {
        this.success("同步成功");
        this.loading1 = false;
      });
    },
    //刷新redis
    RefRedis() {
      this.$confirm("确定更新Redis数据?", "提示", {})
        .then(() => {
          this.loading3 = true;
          this.API.updateRedisTree().then(() => {
            this.success("更新成功");
            this.loading3 = false;
          });
        })
        .catch(() => {});
    },
    getUserOpinion(obj) {
      this.SystemSettingPageList.supervisionLeaderOpinion =
        "," + obj.origId + ",";
    },
    getUserMobile(obj) {
      this.SystemSettingPageList.supervisionMobileAllData =
        "," + obj.origId + ",";
    },
    getUserLeader(obj) {
      this.SystemSettingPageList.supervisionDefaultLeader =
        "," + obj.origId + ",";
    },
    //栏目输入框回显
    echoColumn() {
      let echoColumnList = this.SystemSettingPageList.homeItemId.split(",");
      this.echoName = "";
      let arr = [];
      echoColumnList.map((item, index) => {
        for (let i = 0; i < this.myColumnList.length; i++) {
          let user = this.myColumnList[i];
          if (user.id == item) {
            arr.push(user.name);
            this.echoName = arr.join(",");
          }
        }
      });
    },
    //获取栏目
    getColumnTree() {
      this.$store.dispatch("getMyColumnList");
    },
    //选择栏目弹窗
    showUserDialog() {
      this.sortDialogVisible = true;
      //tree回显
      this.columnCheckList = this.SystemSettingPageList.homeItemId.split(",");
    },
    //获取分页
    getSystemConfig() {
      let tem = this.searchDto;
      this.API.getSystemSettingPageList(tem).then(ret => {
        this.SystemSettingPageList = ret.data.records[0];
        let {
          officialRegisterExportFile,
          officialRegisterExportFileId,
          letterRegisterExportFile,
          letterRegisterExportFileId
        } = ret.data.records[0];
        this.fileList.push({
          name: officialRegisterExportFile,
          url: officialRegisterExportFileId
        });
        this.fileList2.push({
          name: letterRegisterExportFile,
          url: letterRegisterExportFileId
        });
        this.echoColumn();
      });
    },
    //保存
    saveSystem() {
      console.log(this.SystemSettingPageList);
      let tem = { body: this.SystemSettingPageList };
      this.API.addOrUpdateSystemSetting(tem).then(() => {
        this.success("保存成功");
      });
    },
    //选择栏目
    saveColumn() {
      let param = "";
      this.$refs.columnTreeRef.getCheckedNodes().map(item => {
        param += item.id + ",";
      });
      this.SystemSettingPageList.homeItemId = "," + param;
      this.sortDialogVisible = false;
      this.echoColumn();
    }
  }
};
</script>
<style scoped lang="less">
/deep/ .el-card__body {
  padding: 0;
}

.border {
  padding: 19px 0 19px 20px;
  border-bottom: 1px solid rgba(224, 238, 249, 1);
}

.input_content {
  margin-left: 10px;
  float: left;
  width: 400px;
  height: auto;
  box-sizing: border-box;
  font-size: 14px;
  /*color: #666666;*/
  text-align: left;
  margin-bottom: 12px;
}

.input_content1 {
  float: left;
  // width: 45.4%;
  height: auto;
  margin-right: 60px;
  margin-top: 5px;
  margin-bottom: 30px;
  box-sizing: border-box;
  font-size: 14px;
  /*color: #666666;*/
  // text-align: left;
}

/deep/ .el-tabs__header {
  margin-bottom: 40px;
}

/deep/ .el-form-item__label {
  font-size: 15px;
  text-align: left;
}

/deep/ .el-tree-node__label {
  font-size: 16px;
}

#column /deep/ .el-input__inner {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/deep/ .el-switch__label {
  color: #99b4ca;
}

/deep/ .el-switch__label.is-active {
  color: #409eff;
}
.upload-demo {
  width: 300px;
}
</style>
